package wzh.crm.bl;

import android.os.AsyncTask;

import java.util.concurrent.ExecutionException;

import wzh.crm.db.CURDDB;
import wzh.crm.vo.OpportunityVo;

/**
 * Created by wangzehao on 2016/6/20.
 */
public class OpportunityBL extends CURDBL<OpportunityVo> {
    OpportunityBL(CURDDB<OpportunityVo> db) {
        super(db);
    }

    public String getDetailInBackground(final OpportunityVo model){
        AsyncTask<Object, Object, String> asyncTask=new AsyncTask<Object, Object, String>() {

            @Override
            protected String doInBackground(Object... params) {
                return getDetail(model);
            }
        };
        asyncTask.execute(new Object());
        String details= "";
        try {
            details = asyncTask.get();
        } catch (InterruptedException e) {
            e.printStackTrace();
        } catch (ExecutionException e) {
            e.printStackTrace();
        }
        return details;
    }

    public String getDetail(final OpportunityVo model){
        return model.get预计销售金额()+"元|来自客户["+BL.customerBL().getCustomerName(model.get对应客户编号())+"]";
    }
}
